package cn.iocoder.yudao.module.cms.article.vo;

import cn.iocoder.yudao.module.cms.article.dal.dataobject.ArticleCategoryDO;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.TransPojo;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

/**
 * 文章 Base VO，提供给添加、修改、详细的子 VO 使用
 * 如果子 VO 存在差异的字段，请不要添加到这里，影响 Swagger 文档生成
 */
@Tag(name = "文章基础 VO")
@Data
@JsonIgnoreProperties(value = {"pkey", "transMap"}) // 由于 Easy-Trans 会添加 transMap 属性，避免 Jackson 在 Spring Cache 反序列化报错
public class ArticleBaseVO implements TransPojo {

    @Schema(description = "栏目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15458")
    @NotNull(message = "栏目编号不能为空")
    @Trans(type = TransType.SIMPLE, target = ArticleCategoryDO.class, fields = "name", ref = "categoryName")
    private Long categoryId;

    @Schema(description = "栏目名称", example = "新闻资讯")
    private String categoryName;

    @Schema(description = "文章标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "这是一个标题")
    @NotNull(message = "文章标题不能为空")
    private String title;

    @Schema(description = "文章作者", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
    private String author;

    @Schema(description = "文章封面图片地址", example = "https://example.local/xxx.jpg")
    private String picUrl;

    @Schema(description = "文章简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "这是一个简介")
    private String introduction;

    @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @NotNull(message = "排序不能为空")
    private Integer sort;

    @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @NotNull(message = "状态不能为空")
    private Integer status;

    @Schema(description = "是否热门(小程序)", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
    @NotNull(message = "是否热门(小程序)不能为空")
    private Boolean recommendHot;

    @Schema(description = "文章内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "这是文章内容")
    @NotNull(message = "文章内容不能为空")
    private String content;

}
